<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core">

	<ui:composition>

		<h:outputText value="Living Room" styleClass="txt_titulo_pagina" />
		<h:form>
			<div align="center">
				<h:panelGrid id="panel" columns="5" border="0" cellpadding="5" cellspacing="5">
					<f:facet name="header">
						<h:outputText value="#{messages.ALARM}" styleClass="txt_titulo_tabela" />
					</f:facet>
					<h:outputLabel for="alarmTime" value="#{messages.HORA}" styleClass="txt_labels_pesquisa" />
					<h:inputText id="alarmTime"
								value="#{livingRoomBean.currentAlarm}" size="5"
								styleClass="txt_textbox"
								required="true"
								requiredMessage="hh:mm">
						<f:validateLength minimum="5" maximum="5" />
					</h:inputText>
					<h:message for="alarmTime" styleClass="errorMessage"/>
					<h:selectOneRadio value="#{livingRoomBean.alarmOption}">
   						<f:selectItems value="#{livingRoomBean.alarmOptionValue}" />
   						<f:ajax render="alarmSound"/>
   					</h:selectOneRadio>
   					<h:panelGroup id="alarmSound" layout="block">
   						<h:inputText value="#{livingRoomBean.voice}" id="voice" rendered="#{livingRoomBean.alarmOption == 1}"/>
   						<h:selectOneMenu id="music" rendered="#{livingRoomBean.alarmOption == 2}" value="#{livingRoomBean.musicCollection}"> 
   							<f:selectItems  value="#{livingRoomBean.musicCollectionValue}"/>
   						</h:selectOneMenu>
					</h:panelGroup>
					<f:facet name="footer">
						<h:panelGroup style="display:block; text-align:center">
							<h:commandButton id="newAlarm" type="submit"
								value="New Alarm" action="#{livingRoomBean.saveAlarm}"
								styleClass="txt_botao1" />
							<h:commandButton type="submit" id="clear" value="Clear"
								action="#{livingRoomBean.clearAlarm}" styleClass="txt_botao1" />			
						</h:panelGroup>
					</f:facet>
				</h:panelGrid>
			</div>
		</h:form>


	</ui:composition>

</html>